<?php

    // Created By : Noan Babao
    // B.S. Computer Science - De La Salle Canlubang
    // October 27,2011
    //NOT IN parameters : documentType , documentName documentId , location
    //NOT OUT parameters : List of Attachments.

// Start - Checker for those users who will just go to the page by typing directly in the url.
if ($_POST) {
    // INCLUDES CONFIGURATION VARIABLES FOR DATABASE ACCESS
 $hostName = "localhost";
 $rootName = "dbasegr";
 $dBasePassword = "dbgr2012";
 $dBaseName = 'greenroute';

//    // CONNECT TO DATABASE
    $connect = mysql_connect($hostName,$rootName,$dBasePassword) or die ('Unable to connect!');
    mysql_select_db($dBaseName) or die ('Unable to select database!');

$documentSetupId = $_POST['documentSetupId'];
$documentName  = $_POST['documentName'];
$description  = $_POST['description'];

//GET THE CURRENT DATE TIME
    date_default_timezone_set('Asia/Singapore');
    $currentDateTime = date("Y-m-d H:i:s" , time());
   
//Query Insert to Account
    $queryDocumentSetup = 
            "
                UPDATE DocumentSetup 
                SET documentName ='$documentName', description = '$description', documentSetupLastUpdated = '$currentDateTime'
                WHERE documentSetupId = '$documentSetupId'
            ";
    mysql_query($queryDocumentSetup) or die ('Error in query: $queryDocumentSetup. ' . mysql_error());

    echo json_encode(1);
    
    
    
    
    mysql_close($connect);
}   // End - Checker for those users who will just go to the page by typing directly in the url.
else {
 echo "You are not authorized to view this page. This incident will be reported immediately.";
} 
?>
